home *** CD-ROM | disk | FTP | other *** search
Prolog Source | 1986-10-07 | 767 b | 35 lines |
- /* Program 45 */
- /*
- This program dumps a file to your screen.
- Enter a file name, like EXAMPL44.PRO.
-
- To make this program deterministic, two cuts
- have been added to the print_contents
- predicate.
- */
-
- domains
- file = input
-
- predicates
- start
- print_contents
-
- goal
- start.
-
- clauses
- start:-
- clearwindow,
- write("which file do you want to \nwork with ? "),
- readln(FileName),
- openread(input,FileName),
- readdevice(input),
- print_contents.
- print_contents:-!,
- not(eof(input)),readchar(Y),char_int(Y,T),
- write(T," "),print_contents.
- print_contents:-!,
- nl,readdevice(keyboard),
- write("\nPlease press the space bar"),readchar(_).
-